package com.dqp.cslggroup.UI;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.dqp.cslggroup.R;
import com.dqp.cslggroup.bean.roomElectricity;

import java.util.List;

/**
 * @author 董琴平
 * @version 1.0
 * @date 2021/9/5 0:03
 */
public class EbillAdapter extends BaseAdapter {

    private List<roomElectricity> roomElectricities;
    private LayoutInflater inflater;

    public EbillAdapter(List<roomElectricity> roomElectricity, Context context) {
        this.roomElectricities = roomElectricity;
        this.inflater = LayoutInflater.from(context);
    }


    public int getCount() {
        return roomElectricities == null ? 0 : roomElectricities.size();
    }


    public Object getItem(int position) {
        return roomElectricities.get(position);
    }


    public long getItemId(int position) {
        return position;
    }


    public View getView(int position, View convertView, ViewGroup parent) {
        @SuppressLint("ViewHolder") View view = inflater.inflate(R.layout.grade_more_item, null);
        roomElectricity roomElectricity = (roomElectricity) getItem(position);
        TextView textview_1 = view.findViewById(R.id.cjfx);
        TextView textview_2 = view.findViewById(R.id.fxbl);
        TextView textview_3 = view.findViewById(R.id.cj);
        textview_1.setText(roomElectricity.getRoom());
        textview_2.setText(roomElectricity.getTime());
        textview_3.setText(roomElectricity.getQuantity());
        return view;
    }

}
